package com.service.bank.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.client.model.pojo.bank.DepositRecord;
import com.client.model.pojo.bank.DepositType;
import com.client.model.vo.common.Result;
import com.client.model.vo.common.ResultCodeEnum;
import com.service.bank.service.DepositRecordService;
import com.service.bank.service.DepositTypeService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author：刘文举
 * @DateTime： 2024/4/2 16:12
 * @PackageName: com.service.bank.controller
 * @ClassName: DepositTyepController
 */
@RestController
@RequestMapping("/airui/api/depositType")
public class DepositTyepController {


    @Autowired
    private DepositTypeService depositTypeService;
    @Autowired
    private DepositRecordService depositRecordService;

    /**
     * 返回页面的定期，存款年份
     * @return
     */
    @GetMapping("findByDepositType")
    @Operation(summary = "获取定期的定期月份")
    public Result findByDepositType(){
        List<DepositType> isType = depositTypeService.list(new QueryWrapper<DepositType>()
                .eq("is_type", 1));
        return Result.build(isType, ResultCodeEnum.SUCCESS);
    }

    /**
     * 查询申请的
     * @return
     */
    @GetMapping("showApplication")
    @Operation(summary = "后台管理查询申请信息的")
    public Result showApplication(){
        List<DepositRecord> records = depositRecordService.list(new QueryWrapper<DepositRecord>()
                .orderByAsc("status"));
        return Result.build(records, ResultCodeEnum.SUCCESS);
    }

}
